﻿using Oracle.DataAccess.Client;
using System;
using System.Data;
using WorkFlow.DBProxy;

namespace WorkFlow.Engine.NSProcess
{
    public class WfProcess
    {
        public static bool Complete(int procID, bool isComplete)
        {
            var obj = new[]
                {
                    new OracleParameter("var_procId", OracleDbType.Int32) {Value = procID}, //0
                    new OracleParameter("var_userId", OracleDbType.Int32) {Value = procID}, //1
                    new OracleParameter("var_ident", OracleDbType.Int32) {Value = isComplete==true?WfFieldCode.DbTrue:WfFieldCode.DbFalse}, //2
                    new OracleParameter("var_result", OracleDbType.Int32) //3 对应返回值为varchar2类型,要这样,方向在外面设置
                };
            obj[3].Direction = ParameterDirection.Output;
            DB.ExecuteProc("CompleteOrTermainateProc", obj);
            return obj[3] != null && Convert.ToInt32(obj[3].Value.ToString()) > 0;
        }
    }
}